<%@ page contentType="text/html; charset=utf-8" language="java" pageEncoding="utf-8" %>
<%@ page import="java.sql.*, org.json.simple.*, dreampack.dataModify.*" %>
<%@ include file="/common.jsp" %>
<%
	//set Chinese Char 
	//request.setCharacterEncoding("utf-8");
	//response.setCharacterEncoding("utf-8");
	//response.setContentType("text/html; charset=utf-8");
	
	//set the content don't use cache
	//这样可以避免客户端 发送ajax请求，可能使用的是缓存数据，导致数据无效
	response.setHeader("pragma","no-cache"); 
	response.setHeader("cache-control","no-cache"); 
	response.setDateHeader("expires", -10);

	//发送站内邮件
	out.clear();	//这样在客户端就不会出现N多空行开头了
	JSONObject json = null;

	String mailTitle = request.getParameter("mailtitle");
	String mailTo = request.getParameter("mailto");
	String mailContent = request.getParameter("mailcontent");
	UserType toUser = UserQuery.queryByName(dreamDB, mailTo);
	if (null == toUser || toUser.equals(null))
		out.print(false);
	else {
		UserType user = (UserType)session.getAttribute("user");
		boolean bRet = EmailModify.sendEmail(dreamDB, toUser, mailTitle, "", mailContent, user);
		out.print(bRet);
	}
	out.flush();
%>
